package com.xauto.pioneer.appuser.adapter;

import android.app.Activity;
import android.view.View;
import android.widget.TextView;

import com.xauto.pioneer.appuser.R;
import com.xauto.pioneer.appuser.model.MemberMessageInfoData;

/**
 * 消息匹配列表
 */

public class MessageAdapter extends AbsAdapter<MemberMessageInfoData> {
    private int selectPosition = -1;


    public void setSelectPosition(int selectPosition) {
        this.selectPosition = selectPosition;
    }

    public MessageAdapter(Activity context, int layout) {
        super(context, layout);
    }

    @Override
    public ViewHolder<MemberMessageInfoData> getHolder() {
        return new TemplateViewHolder();
    }


    private class TemplateViewHolder implements ViewHolder<MemberMessageInfoData> {
        private TextView message_title;
        private TextView message_date;
        private String is_read="0";
        @Override
        public void initViews(View v, int position) {
            message_title = (TextView) v.findViewById(R.id.message_title);
            message_date = (TextView) v.findViewById(R.id.message_date);
        }

        @Override
        public void updateData(MemberMessageInfoData memberMessageListDate, int position) {
            message_title.setText(memberMessageListDate.member_message_title);
            message_date.setText(memberMessageListDate.member_message_date);
            is_read=memberMessageListDate.is_read;
            message_date.setTextColor(context.getResources().getColor(R.color.main_gray));
            if(is_read.equals("0")){
                message_title.setTextColor(context.getResources().getColor(R.color.main_black));
            }else{
                message_title.setTextColor(context.getResources().getColor(R.color.main_gray));
            }

        }

        @Override
        public void doOthers(MemberMessageInfoData voucherDetailInfo, int position) {

        }
    }
}
